<template>
  <el-main>
    <!-- 查询条件 -->
    <el-form
      ref="searchForm"
      :model="searchModel"
      label-width="55px"
      :inline="true"
      size="mini"
    >
      <el-form-item>
        <el-input v-model="searchModel.code" placeholder="客户编码" />
      </el-form-item>

      <el-form-item>
        <el-input v-model="searchModel.name" placeholder="客户名称" />
      </el-form-item>

      <el-form-item>
        <span  slot="label">
          <span class="formLabel"><strong>等级</strong></span>
        </span>
        <el-select v-model="searchModel.level" placeholder="请选择" style="width: 180px">
          <el-option
            v-for="item in typeOpts"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>

      <el-form-item>
        <span  slot="label">
          <span class="formLabel"><strong>类别</strong></span>
        </span>
        <el-select v-model="searchModel.type" placeholder="请选择" style="width: 180px">
          <el-option
            v-for="item in typeOpts"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>

      <el-form-item>
        <span  slot="label">
          <span class="formLabel"><strong>状态</strong></span>
        </span>
        <el-select v-model="searchModel.status" placeholder="请选择" style="width: 180px">
          <el-option
            v-for="item in statusOpts"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button
          size="mini"
          icon="el-icon-search"
          type="primary"
          @click="search(pageNo, pageSize)"
        >查询</el-button>
        <el-button icon="el-icon-delete" @click="resetValue()" size="mini">重置</el-button>
      </el-form-item>
      <!-- 功能 -->
      <div style="margin: 0px 0px 5px 0px">
            <el-button
            style="font-size: 10px"
            icon="el-icon-plus"
            size="mini"
            type="primary"
            @click="openAddWindow()"
          >新增</el-button>
          <el-button
            style="font-size: 10px"
            icon="el-icon-circle-check"
            size="mini"
            type="success"
            @click="handleAudit()"
          >审核</el-button>
          <el-button
            style="font-size: 10px"
            icon="el-icon-circle-close"
            size="mini"
            type="warning"
            @click="onAudit()"
          >反审</el-button>
          <!-- 批量删除 -->
          <el-button style="font-size: 10px" @click="handleDelete()" size="mini" icon="el-icon-delete" type="danger">删除</el-button>
          <el-button
            style="font-size: 10px"
            icon="el-icon-download"
            size="mini"
            type="primary"
            plain
            @click="dowonloadExcel()"
          >导出</el-button>
          <el-button
            style="font-size: 10px"
            icon="el-icon-upload2"
            size="mini"
            type="success"
            plain
            @click="importExcel()"
          >导入</el-button>
      </div>
    </el-form>
    <!-- 数据列表 -->
    <el-table

      class="tableBox"
      style="width: 100%; font-size: 15px"
      :data="customerList"
      :height="tableHeight"
      border
      stripe

      @selection-change="handleSelectionChange"
      :header-cell-style="{'text-align':'center'}"
      :cell-style="{'text-align':'center'}">
      <el-table-column width="65px"
        type="selection">
      </el-table-column>
      <el-table-column
        prop="code"
        label="客户编码">
      </el-table-column>v
      <el-table-column
        prop="name"
        label="客户名称">
      </el-table-column>
      <el-table-column
        prop="companyName"
        label="公司名称">
      </el-table-column>
      <el-table-column
        prop="type"
        label="客户类别">
      </el-table-column>
      <el-table-column
        prop="level"
        label="客户等级">
      </el-table-column>
      <el-table-column
        prop="customerManager"
        label="客户经理">
      </el-table-column>
      <el-table-column
        prop="status"
        label="状态">
        <template slot-scope="scope" >
          <el-tag v-if="scope.row.status === 1" type="success" size="mini" style="font-size: 5px">已启用</el-tag>
          <el-tag v-else type="danger" size="mini" style="font-size: 5px">未启用</el-tag>
        </template>
      </el-table-column>
      <el-table-column
        label="操作"
        width="350px"
        >
        <template slot-scope="scope">
          <el-button @click="handleEdit(scope.row)"  size="mini" type="primary" icon="el-icon-edit-outline" style="font-size: 10px">编辑</el-button>
          <el-button @click="del(scope.row.id)" icon="el-icon-delete" type="warning" size="mini" style="font-size: 10px">删除</el-button>
          <el-button @click="handleINFO(scope.row)" type="success" icon="el-icon-view" size="mini" plain style="font-size: 10px">查看</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div style="margin-top: 10px">
      <!-- 分页工具栏 -->
      <el-pagination
        background
        :current-page="pageNo"
        :page-sizes="[10, 20, 30, 40, 50]"
        :page-size="10"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </div>

   <!-- 添加和修改窗口 -->
    <system-dialog
      :title="cusDialog.title"
      :visible="cusDialog.visible"
      :width="cusDialog.width"
      :height="cusDialog.height"
      @onClose="onClose"
      @onConfirm="onConfirm"
    >
      <div slot="content">

        <el-form
          ref="cusForm"
          :model="cusData"
          :rules="rules"
          label-width="130px"
          :inline="true"
          size="mini"
          class="demo-form-inline"
        >
          <p>基本信息</p>
            <el-form-item  prop="code" >
              <span  slot="label">
                <span class="formLabel"><strong>客户编码</strong></span>
              </span>
                <el-input v-model="cusData.code" />
            </el-form-item>
            <el-form-item  prop="name" >
            <span  slot="label">
              <span class="formLabel"><strong>客户名称</strong></span>
            </span>
              <el-input v-model="cusData.name" class="f-item"/>
            </el-form-item>
            <el-form-item label="公司名称"  prop="companyName">
              <span  slot="label">
                <span class="formLabel"> <strong>公司名称</strong></span>
              </span>
              <el-input v-model="cusData.companyName"  class="f-item"/>
            </el-form-item>

            <el-form-item prop="level"  label="客户等级">
              <span  slot="label">
                <span class="formLabel"><strong>客户等级</strong></span>
              </span>
                <el-select v-model="cusData.level" placeholder="请选择" style="width: 220px">
                  <el-option
                    v-for="item in levelOpts"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              <!-- <el-input v-model="label" /> -->
            </el-form-item>
            <el-form-item prop="type"  label="客户类别">
              <span  slot="label">
                <span class="formLabel"><strong>客户类别</strong></span>
              </span>
                <el-select v-model="cusData.type" placeholder="请选择" style="width: 220px">
                  <el-option
                    v-for="item in typeOpts"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
            </el-form-item>

            <el-form-item  prop="contactNumber">
              <span  slot="label">
                <span class="formLabel"><strong>联系电话</strong></span>
              </span>
              <el-input v-model="cusData.contactNumber" class="f-item"/>
            </el-form-item>
            <el-form-item label="微信"  prop="wechat">
              <span  slot="label">
                <span class="formLabel"><strong>微信</strong></span>
              </span>
              <el-input v-model="cusData.wechat" class="f-item"/>
            </el-form-item>
            <el-form-item prop="mailbox"  label="邮箱">
              <span  slot="label">
                <span class="formLabel"><strong>邮箱</strong></span>
              </span>
              <el-input v-model="cusData.mailbox" class="f-item"/>
            </el-form-item>

            <el-form-item prop="customerManager"  label="客户经理">
              <span  slot="label">
                <span class="formLabel"><strong>客户经理</strong></span>
              </span>
              <el-input v-model="cusData.customerManager" class="f-item"/>
            </el-form-item>

            <el-form-item prop="status"  label="状态">
              <span  slot="label">
                <span class="formLabel"><strong>状态</strong></span>
              </span>
              <el-checkbox v-model="checked"></el-checkbox>
              <span>
                <span class="formLabel"><strong> 启用</strong></span>
              </span>
            </el-form-item>

            <el-form-item label="备注" prop="remark">
              <span  slot="label">
                <span class="formLabel"><strong>备注</strong></span>
              </span>
              <el-input style="width: 450px" v-model="cusData.remark" type="textarea" :rows="3" />
            </el-form-item>
        </el-form>
      </div>
    </system-dialog>
    <!-- 详情信息窗口 -->
    <system-info-dialog
      :title="infoDialog.title"
      :visible="infoDialog.visible"
      :width="infoDialog.width"
      :height="infoDialog.height"
      @onClose="onClose"
    >
      <div slot="content">

        <el-form
          ref="cusForm"
          :model="cusData"
          :rules="rules"
          label-width="130px"
          :inline="true"
          size="mini"
          class="demo-form-inline"
        >
          <p>基本信息</p>
            <el-form-item  prop="code" >
              <span  slot="label">
                <span class="formLabel"><strong>客户编码</strong></span>
              </span>
                <el-input v-model="cusData.code" />
            </el-form-item>
            <el-form-item  prop="name" >
            <span  slot="label">
              <span class="formLabel"><strong>客户名称</strong></span>
            </span>
              <el-input v-model="cusData.name" />
            </el-form-item>
            <el-form-item label="公司名称"  prop="companyName" >
              <span  slot="label">
                <span class="formLabel"><strong>公司名称</strong></span>
              </span>
              <el-input v-model="cusData.companyName"/>
            </el-form-item>

            <el-form-item prop="level"  label="客户等级">
              <span  slot="label">
                <span class="formLabel"><strong>客户等级</strong></span>
              </span>
                <el-select v-model="cusData.level" placeholder="请选择" style="width: 220px">
                  <el-option
                    v-for="item in levelOpts"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              <!-- <el-input v-model="label" /> -->
            </el-form-item>
            <el-form-item prop="type"  label="客户类别">
              <span  slot="label">
                <span class="formLabel"><strong>客户类别</strong></span>
              </span>
                <el-select v-model="cusData.type" placeholder="请选择" style="width: 220px" >
                  <el-option
                    v-for="item in typeOpts"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
            </el-form-item>

            <el-form-item  prop="contactNumber">
              <span  slot="label">
                <span class="formLabel"><strong>联系电话</strong></span>
              </span>
              <el-input v-model="cusData.contactNumber" />
            </el-form-item>

            <el-form-item label="微信"  prop="wechat">
              <span  slot="label">
                <span class="formLabel"><strong>微信</strong></span>
              </span>
              <el-input v-model="cusData.wechat" />
            </el-form-item>
            <el-form-item prop="mailbox"  label="邮箱">
              <span  slot="label">
                <span class="formLabel"><strong>邮箱</strong></span>
              </span>
              <el-input v-model="cusData.mailbox" />
            </el-form-item>

            <el-form-item prop="customerManager"  label="客户经理">
              <span  slot="label">
                <span class="formLabel"><strong>客户经理</strong></span>
              </span>
              <el-input v-model="cusData.customerManager" />
            </el-form-item>
            <el-form-item prop="status"  label="状态">
              <span  slot="label">
                <span class="formLabel"><strong>状态</strong></span>
              </span>
              <el-checkbox v-model="checked"></el-checkbox>
              <span>
                <span class="formLabel"><strong> 启用</strong></span>
              </span>
            </el-form-item>
            <el-form-item label="备注" prop="remark">
              <span  slot="label">
                <span class="formLabel"><strong>备注</strong></span>
              </span>
              <el-input style="width: 450px" v-model="cusData.remark" type="textarea" :rows="3" />
            </el-form-item>
            <p>系统信息</p>
              <el-form-item  prop="contactNumber">
                <span  slot="label">
                  <span class="formLabel"><strong>创建人</strong></span>
                </span>
                <el-input v-model="cusData.createBy" />
              </el-form-item>
              <el-form-item label="创建日期"  prop="wechat">
                <span  slot="label">
                  <span class="formLabel"><strong>创建日期</strong></span>
                </span>
                <el-input v-model="cusData.createTime" />
              </el-form-item>
              <el-form-item prop="mailbox"  label="审核人">
                <span  slot="label">
                  <span class="formLabel"><strong>审核人</strong></span>
                </span>
                <el-input v-model="cusData.approveBy" />
              </el-form-item>

              <el-form-item prop="customerManager"  label="审核日期">
                <span  slot="label">
                  <span class="formLabel"><strong>审核日期</strong></span>
                </span>
                <el-input v-model="cusData.approveTime" />
              </el-form-item>
        </el-form>
      </div>
    </system-info-dialog>
    <!-- 导入 -->
    <upload-excel-dialog
      :title="uploadDialog.title"
      :visible="uploadDialog.visible"
      :width="uploadDialog.width"
      :height="uploadDialog.height"
      @onClose="onClose"
    >
      <div slot="content">
        <el-form label-width="90px">
          <el-form-item label="信息描述" >
            <span  slot="label">
              <span class="formLabel"><strong>模板</strong></span>
            </span>
            <el-tag>
              <i class="el-icon-download"/>
              <a
                :href="'/static/data1.xlsx'">下载模版</a>
            </el-tag>
          </el-form-item>

          <el-form-item label="">
            <span  slot="label">
              <span class="formLabel"><strong>选择文件</strong></span>
            </span>
            <!-- auto-upload="false 手动上传
            :limit="1" 限制上传文件的 数量
            name="file" <input type='file'>
            accept="application/vnd.ms-excel" 只接受excel类型文件 ms微软 只接受 微软的
            -->
            <el-upload
              ref="upload"
              :before-upload="beforeUpload"
              :on-change="uploadChange"
              :auto-upload="false"
              :on-success="fileUploadSuccess"
              :on-error="fileUploadError"
              :on-exceed="handleExceed"
              :limit="1"
              :file-list="fileList"
              :headers="TOKEN"
              :action="BASE_API+'api/customer/import'"
              false
              手动上传
              name="file"
              accept="application/vnd.ms-excel,.xls,.xlsx">
                <el-button slot="trigger" size="mini" type="primary">选取文件</el-button>
                <el-button
                  :loading="loading"
                  style="margin-left: 10px;"
                  size="mini"
                  type="success"
                  @click="submitUpload">{{ fileUploadBtnText }}
                </el-button>
                <p slot="tip" class="el-upload__tip">支持文件格式 .xls .xlsx, 且不超过10mb</p>
              </el-upload>
          </el-form-item>
        </el-form>
      </div>
    </upload-excel-dialog>
  </el-main>
</template>

<script>
import axios from 'axios'
import { getToken } from '@/utils/auth'

//导入客户资料api脚本
import cusApi from '@/api/basics/customer';

//导入对话框组件
import SystemDialog from '@/components/system/SystemDialog.vue';
import SystemInfoDialog from '@/components/system/SystemInfoDialog.vue';
import UploadExcelDialog from '@/components/system/UploadExcelDialog';

export default {
    //注册组件
   components:{
      SystemDialog,
      SystemInfoDialog,
      UploadExcelDialog
   },
   data() {
      return {
        multipleSelection: [],
        customerList: [],
        tableHeight: 0, // 表格高度
        pageNo: 1, // 当前页码
        pageSize: 10, // 每页显示数量
        total: 0, // 总数量
        checked: false,
        // 查询条件对象
        searchModel: {
          code: '',
          name: '',
          type: '',
          level: '',
          status: '',
          pageNo: 1,
          pageSize: 10
        },
        cusData: {
          id: '',
          code: '',
          name: '',
          companyName: '',
          type: 0,
          level: 0,
          status: 0,
          remark: '',
          customerManager: '',
          contactNumber: '',
          wechat: '',
          mailbox: '',
          approveBy: '',
          approveTime: '',
          createBy: '',
          createTime: ''
        },
        // 添加和修改客户资料窗口属性
        cusDialog: {
          title: '',
          visible: false,
          height: 550,
          width: 810
        },
        infoDialog: {
          title: '',
          visible: false,
          height: 670,
          width: 810
        },
        uploadDialog: {
          title: '',
          visible: false,
          height: 300,
          width: 600
        },
        // 弹框
        rules: {
          name: [{ required: true, trigger: 'blur', message: '请输入客户名称' }],
          companyName: [{ required: true, trigger: 'blur', message: '请输入公司名称' }]
        },

        levelOpts: [{
          value: 0,
          label: '黄金糕'
        }, {
          value: 1,
          label: '双皮奶'
        }, {
          value: 2,
          label: '蚵仔煎'
        }, {
          value: 3,
          label: '龙须面'
        }, {
          value: 4,
          label: '北京烤鸭'
        }],

        typeOpts: [{
          value: 0,
          label: '黄金糕'
        }, {
          value: 1,
          label: '双皮奶'
        }, {
          value: 2,
          label: '蚵仔煎'
        }, {
          value: 3,
          label: '龙须面'
        }, {
          value: 4,
          label: '北京烤鸭'
        }],

        statusOpts: [{
          value: 0,
          label: '未审核'
        }, {
          value: 1,
          label: '已审核'
        }],

        auditObj: {
          ids: []
        },
        // // 上传文件
        // limitNum: 1,  // 上传excell时，同时允许上传的最大数
        BASE_API: process.env.VUE_APP_BASE_API,
        TOKEN: {"token": getToken()},
        // //上传后的文件列表
        fileList: [],
        fileUploadBtnText: '导 入', // 按钮文字
        importBtnDisabled: false, // 按钮是否禁用,
        loading: false,
        fileListLen: 0
      }
    },
    created(){
      this.search()
    },
    // 挂载后调用
    mounted() {
      this.$nextTick(() => {
        this.tableHeight = window.innerHeight - 335
      })
    },
    methods: {
      // ==================================上传文件===========================================
      // 上传文件到服务器
      // 文件状态改变时的钩子
      uploadChange(file, fileList) {
          this.file = file.raw
          // 问题一方案：验证文件数量，替换后仅保留第一个文件
          if (fileList.length > 1) {
            fileList.splice(0, 1)
          }
          this.fileListLen = fileList.length
        },

      handleExceed(files, fileList) {
        this.$message.warning(`只能选择 1 个文件，当前共选择了 ${files.length + fileList.length} 个`);
      },
      // 提取文件后缀名
      getSuffix(str) {
        const fileExtension = str.substring(str.lastIndexOf(".") + 1);
        return fileExtension;
      },
      //导入前判断
      beforeUpload(file,fileList) {
        let suffix = this.getSuffix(file.name);
        if (suffix !== "xlsx") {
          this.$message.error("文件格式只能是.xlsx");
          return false;
        }
      },
      submitUpload() {
        if (this.fileListLen === 0) {
           this.$message.warning("选择文件");
        }else {
          this.fileUploadBtnText = '正在导入...'
          this.importBtnDisabled = true
          this.loading = true
          // 使用vue中的表单提交
          this.$refs.upload.submit()
          this.fileListLen = 0
        }

      },
      // 上传成功
      fileUploadSuccess(response) {
        // 提示信息
        this.loading = false
        this.$message({
          type: 'success',
          message: '导入成功！'
        })
        this.importBtnDisabled = false
        // 跳转到课程分类列表，使用路由跳转
        this.uploadDialog.visible = false
        this.search()
        this.fileUploadBtnText = '导 入'
        this.fileListLen = 0
      },
      // 上传失败
      fileUploadError() {
        // 提示信息
        this.loading = false
        this.$message({
          type: 'error',
          message: '导入失败！'
        })
        this.importBtnDisabled = false
        this.fileListLen = 0
      },

      // ====================================================================================

      // 获取复选框中的数据
      handleSelectionChange(val) {
        this.multipleSelection = val;
      },
      // 审核
      async handleAudit() {
        this.auditObj.ids = this.multipleSelection.map(item => {
          return item.id;
        })
        if (this.auditObj.ids.length > 0) {
          const res = await cusApi.audit(this.auditObj)
          // 判断是否成功
          if (res.success) {
            // 成功提示
            this.$message.success(res.message)
            // 刷新
            this.search()
          } else {
            // 失败提示
            this.$message.error(res.message)
          }
        }
      },
      // 反审核
      onAudit() {
        this.$message.success("此功能后续开发！")
      },
      importExcel() {
        this.fileListLen = 0
        this.fileList = [],
        this.uploadDialog.title = '导入数据'// 设置窗口标题
        this.uploadDialog.visible = true // 显示窗口
      },
      // 数据导出excel
      dowonloadExcel() {
        // this.$message.success("等确认了，Excel模板后 开发接口！")
        axios({
          method: "get",
          url: this.BASE_API+"api/customer/export",
          responseType: 'blob',
          headers: {
            "token": getToken()
          }
        })
        .then(resp => {
          if (!resp) {
              this.$message.warning("导出数据失败！")
              return
            }
            const link = document.createElement('a');
            let blob = new Blob([resp.data], {type: 'application/vnd.ms-excel'});
            link.style.display = 'none';
            link.href = URL.createObjectURL(blob);

            link.setAttribute('download', '客户资料列表' + '.xlsx');
            document.body.appendChild(link);
            link.click();
            document.body.removeChild(link);
        })
      },
      // 批量删除 TODO
      async handleDelete() {
        this.auditObj.ids = this.multipleSelection.map(item => {
            return item.id;
        })
        if (this.auditObj.ids.length > 0) {
          const confirm = await this.$myconfirm('确定要删除该数据吗?')
          if (confirm) {
            const res = await cusApi.del(this.auditObj)
            // 判断是否成功
            if (res.success) {
              // 成功提示
              this.$message.success(res.message)
              // 刷新
              this.search()
            } else {
              // 失败提示
              this.$message.error(res.message)
            }
          }
        }else{
          this.$message.success("请选择要删除的数据！")
        }
      },
      async del(id) {
        this.auditObj.ids = []
        if (id != "" && id != null) {
          this.auditObj.ids  = [id];
        }
        if (this.auditObj.ids.length > 0) {
          const confirm = await this.$myconfirm('确定要删除该数据吗?')
          if (confirm) {
            const res = await cusApi.del(this.auditObj)
            // 判断是否成功
            if (res.success) {
              // 成功提示
              this.$message.success(res.message)
              // 刷新
              this.search()
            } else {
              // 失败提示
              this.$message.error(res.message)
            }
          }
        }
      },
      // 查询客户列表
      async search(pageNo = 1, pageSize = 10) {
        this.searchModel.pageNo = pageNo
        this.searchModel.pageSize = pageSize

        console.log("@@@" ,this.searchModel)
        // 发送查询请求
        const res = await cusApi.pageList(this.searchModel)
        if (res.success) {
          this.customerList = res.data.records
          this.total = res.data.total - 0
        }
      },
      // 当每页数量发生变化时触发该事件
      handleSizeChange(size) {
        this.pageSize = size // 将每页显示的数量交给成员变量
        this.search(this.pageNo, size)
      },
      // 当页码发生变化时触发该事件
      handleCurrentChange(page) {
        this.pageNo = page
        // 调用查询方法
        this.search(page, this.pageSize)
      },
      // 打开添加窗口
      openAddWindow() {
        this.checked = false
        // 清空表单数据
        this.$resetForm('cusForm', this.cusData)
        this.cusDialog.title = '新增客户资料'// 设置窗口标题
        this.cusDialog.visible = true // 显示窗口
      },
      // 关闭窗口
      onClose() {
        this.cusDialog.visible = false
        this.infoDialog.visible = false
        this.uploadDialog.visible = false
      },
      // 窗口确认事件
      onConfirm() {
            // 表单验证
        this.$refs.cusForm.validate(async(valid) => {
          this.cusData.status = this.checked ? 1 : 0;
          if (valid) {
            let res = null
            // 判断id是否为空
            if (this.cusData.id === '') {
              // 新增
              // 发送添加请求
              res = await cusApi.addObj(this.cusData)
            } else {
              // 发送修改请求
              res = await cusApi.updateObj(this.cusData)
            }
            // 判断是否成功
            if (res.success) {
              this.$message.success(res.message)
              // 刷新
              this.search(this.pageNo, this.pageSize)
              // 关闭窗口
              this.cusDialog.visible = false
            } else {
              this.$message.error(res.message)
            }
          }
        })
      },
      // 打开编辑窗口
      handleEdit(row) {
        // 数据回显
        this.$objCopy(row, this.cusData) // 将当前编辑的数据复制到role对象中
        this.checked = this.cusData.status == 1 ? true : false;
        // 设置窗口标题
        this.cusDialog.title = '编辑客户资料'
        // 显示编辑窗口
        this.cusDialog.visible = true
      },
      handleINFO(row) {
        // 数据回显
        this.$objCopy(row, this.cusData) // 将当前编辑的数据复制到role对象中
        this.checked = this.cusData.status == 1 ? true : false;
        // 设置窗口标题
        this.infoDialog.title = '客户资料信息'
        // 显示编辑窗口
        this.infoDialog.visible = true
      },

    /**
      * 重置查询条件
      */
      resetValue() {
        // 清空查询条件
        this.searchModel.code = ''
        this.searchModel.name = ''
        this.searchModel.type = ''
        this.searchModel.level = ''
        this.searchModel.status = ''
        // 重新查询
        this.search()
      },
    }
}
</script>

<style lang="scss">

/* 下拉滚动条 */
::-webkit-scrollbar{
  width: 5px;
  height: 5px;
  background-color: #F5F5F5;
}
::-webkit-scrollbar-track {
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  background-color: #F5F5F5;
}
::-webkit-scrollbar-thumb{
  border-radius: 8px;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, .1);
  -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .1);
  background-color: #c8c8c8;
}

.formLabel {
  font-size: 12px;
  color: #333333;
  font-family: "MicrosoftYaHeiLight", "微软雅黑 Light", "微软雅黑", sans-serif;
  font-weight: 200;
  // line-height: 30px;
}

.f-item>>>.el-input__inner {
   width: 151px;
}

// el-table 表格行高设置
.tableBox {
  th {
    padding: 0 !important;
    height: 35px;
    line-height: 35px;
  }
  td {
    padding: 0 !important;
    height: 35px;
    line-height: 35px;
  }
}

</style>
